package com.chengyu.core.controller.callback.logic;

import cn.hutool.core.collection.CollectionUtil;
import com.chengyu.core.controller.callback.manager.CallbackFactory;
import com.chengyu.core.model.TyOrderRefund;
import com.chengyu.core.service.ty.TyOrderRefundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("tyRefundLogic")
public class TyRefundLogic extends CallbackFactory {

    @Autowired
    private TyOrderRefundService orderRefundService;

    @Override
    public void paySus(String orderNo) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void refundSus(String orderNo) {
        TyOrderRefund refund = orderRefundService.getOrderRefundByRefundNo(orderNo);
        if (CollectionUtil.contains(CollectionUtil.newArrayList(0, 1, 2, 3, 4), refund.getStatus())) {
            orderRefundService.refundSusCallback(refund);
        }
    }

}
